//
//  MessageCenterController.m
//  敢唆嘛!
//
//  Created by lanou on 15/11/27.
//  Copyright © 2015年 zms. All rights reserved.
//

#import "MessageCenterController.h"
#import "Define.h"
#import "Device.h"
#import "MessageModel.h"
@interface MessageCenterController ()

@end

@implementation MessageCenterController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"信息中心";
    self.view.backgroundColor = [UIColor whiteColor];
    
    // 创建左上角返回按钮
    UIButton *backBtn = [UIButton buttonWithType:UIButtonTypeCustom];
    backBtn.frame = CGRectMake(0, 0, KSWidth / 18, KSWidth / 18);
    [backBtn setImage:[UIImage imageNamed:@"iconfont-unie61e"] forState:UIControlStateNormal];
    [backBtn addTarget:self action:@selector(backBtnAction:) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *leftBackBtn = [[UIBarButtonItem alloc] initWithCustomView:backBtn];
    self.navigationItem.leftBarButtonItem = leftBackBtn;
    
    UILabel *title = [[UILabel alloc]initWithFrame:CGRectMake(0, 100, KSWidth, 50)];
    if (self.messageArray.count == 0)
    {
        title.text = @"您还没有消息哟!";
    }
    else
    {
        MessageModel *model = self.messageArray[0];
        title.text = model.messageInfo;
    }
    
    title.textAlignment = NSTextAlignmentCenter;
    [self.view addSubview:title];
}

// 返回按钮触发
- (void)backBtnAction:(UIButton *)backBtn
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
